package main.ServiceImpli;

/**
 * 作者: ALIM-MASTIK
 * 创建实现: 2023/7/15 9:19
 * 项目名称：chat
 * 软件: IntelliJ IDEA
 */
import main.Service.ChatRoomService;
import main.dao.ChatRoomDAO;
import main.pojo.ChatRoom;


import java.util.List;

public class ChatRoomServiceImpl implements ChatRoomService {
    private ChatRoomDAO chatRoomDAO;

    public ChatRoomServiceImpl(ChatRoomDAO chatRoomDAO) {
        this.chatRoomDAO = chatRoomDAO;
    }

    @Override
    public ChatRoom getChatRoomByID(int chatRoomID)   {
        return chatRoomDAO.getChatRoomByID(chatRoomID);
    }

    @Override
    public List<ChatRoom> getAllChatRooms()   {
        return chatRoomDAO.getAllChatRooms();
    }
    @Override
    public Boolean createChatRoom(ChatRoom chatRoom)   {
        if (chatRoomDAO.createChatRoom(chatRoom)!=null){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public Boolean updateChatRoom(ChatRoom chatRoom)  {
        if (chatRoomDAO.updateChatRoom(chatRoom)!=null){
            return true;
        }else {
            return false;
        }
    }
    @Override
    public Boolean deleteChatRoom(int chatRoomID)  {
        if (chatRoomDAO.deleteChatRoom(chatRoomID)!=null){
            return true;
        }else {
            return false;
        }
    }
}
